package com.imooc.coupon.feign;

import com.imooc.coupon.exception.CouponException;
import com.imooc.coupon.feign.hystrix.SettlementClientHystrix;
import com.imooc.coupon.feign.hystrix.TemplateClientHystrix;
import com.imooc.coupon.vo.CommonResponse;
import com.imooc.coupon.vo.SettlementInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 优惠券结算微服务
 * @Author Administrator
 * @Date 2021/11/10 22:09
 * @Version 1.0
 */
@FeignClient(value = "eureka-client-coupon-template" , fallback = SettlementClientHystrix.class)//想调用的微服务应用名称
public interface SettlementClient {

    /**
     * 优惠券规则计算
     * @param settlementInfo
     * @return
     * @throws CouponException
     */
    @RequestMapping(value="/coupom-settlement/settlement/complete", method = RequestMethod.POST)
    CommonResponse<SettlementInfo> computeRule(@RequestBody SettlementInfo settlementInfo) throws CouponException;


}
